package com.kandinfo.base.security.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kandinfo.base.common.service.AbstractService;
import com.kandinfo.base.security.domain.UserRole;
import com.kandinfo.base.security.repository.UserRoleRepository;
import com.kandinfo.base.security.service.UserRoleService;

@Service
public class UserRoleServiceImpl extends AbstractService<UserRole,Long,UserRoleRepository> implements UserRoleService {
        
    @Resource
    public void setUserRoleRepository(UserRoleRepository userRoleRepository){
        super.setRepository(userRoleRepository);
    } 

    @Autowired
    private UserRoleRepository userRoleRepository;
    
    @Override
    public UserRole save(UserRole userRole) {
        return userRoleRepository.save(userRole);
    }
    
    @Override
    public List<UserRole> findByUserId(Long userId){
        return userRoleRepository.findByUserId(userId);
    }
    
    @Override
    public List<UserRole> findByRoleId(Long roleId){
        return userRoleRepository.findByRoleId(roleId);
    }

    @Override
    public List<UserRole> findByRidUid(Long sId, Long dId) {
        return userRoleRepository.findByRidUid(sId , dId);
    }

}
